package fhp.hlhj.giantfold.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import fhp.hlhj.giantfold.R
import fhp.hlhj.giantfold.javaBean.MessageCenterBean
import kotlinx.android.synthetic.main.message_center_item.view.*

/**
 * author: FHP
 * data: on 2017\11\28 0028 15:35
 * E-Mail: 103945089@qq.com
 */
class MessageCenterListAdp(layoutId:Int, data:List<MessageCenterBean>) :BaseQuickAdapter<MessageCenterBean,BaseViewHolder>(layoutId,data) {
    override fun convert(helper: BaseViewHolder?, item: MessageCenterBean?) {
        when(helper?.layoutPosition){
            0->{
                helper.setImageResource(R.id.img1,R.mipmap.xiaoxizhongxin_xx)
                helper.setText(R.id.tv1,"系统消息")
                helper.setText(R.id.tvUnread,item?.unread_count1.toString())
                helper.setText(R.id.itemTitle,item?.latestMessage1?.title)
                helper.setText(R.id.itemTime,item?.latestMessage1?.sent_time)
                helper.setText(R.id.itemInfo,item?.latestMessage1?.message)
            }
            1->{
                helper.setImageResource(R.id.img1,R.mipmap.xiaoxizhongxin_hdxx)
                helper.setText(R.id.tv1,"活动消息")
                helper.setText(R.id.tvUnread,item?.unread_count2.toString())
                helper.setText(R.id.itemTitle,item?.latestMessage2?.title)
                helper.setText(R.id.itemTime,item?.latestMessage2?.sent_time)
                helper.setText(R.id.itemInfo,item?.latestMessage2?.message)
            }
        }
    }

    override fun getItemCount(): Int {
            return 2
    }
}